package com.ssy.lingxi.order.entity;

import com.fasterxml.jackson.annotation.JsonBackReference;

import javax.persistence.*;
import java.io.Serializable;

/**
 * 平台后台 - 会员支付策略配置 - 关联的会员
 * @author 万宁
 * @version 2.0.0
 * @date 2021-08-10
 */
@Entity
@Table(schema = "public", name = "ord_platform_payment_member", indexes = {@Index(name = "ord_platform_payment_member_payment_id_idx", columnList = "payment_id"), @Index(name = "ord_platform_payment_member_role_id_idx", columnList = "memberId,roleId")})
public class PlatformPaymentMemberDO implements Serializable {
    private static final long serialVersionUID = -855808300392910685L;

    /**
     * 主键Id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ord_platform_payment_member_seq")
    @SequenceGenerator(sequenceName = "ord_platform_payment_member_seq", name = "ord_platform_payment_member_seq", allocationSize = 1)
    private Long id;

    /**
     * 多对一双向关联会员支付策略配置
     */
    @JsonBackReference
    @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    @JoinColumn(name = "payment_id")
    private PlatformPaymentDO payment;

    /**
     * 适用的会员Id
     */
    @Column
    private Long memberId;

    /**
     * 适用的会员角色Id
     */
    @Column
    private Long roleId;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public PlatformPaymentDO getPayment() {
        return payment;
    }

    public void setPayment(PlatformPaymentDO payment) {
        this.payment = payment;
    }

    public Long getMemberId() {
        return memberId;
    }

    public void setMemberId(Long memberId) {
        this.memberId = memberId;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }
}
